<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    // 验证哥德巴赫猜想
    // 任意一个偶数可以拆分为两个质数之和


    // 验证猜想
    function isgdbh(num) {
      var flag = false;
      for (var i = 2; i < num; i++) {
        if (isprime(i) && isprime(num - i)) {
          flag = true;
          break;
        } else {
          continue;
        }
      }
      return flag;
    }
    // 判断是否为质数
    function isprime(num) {
      var flag = true;
      for (var j = 2; j < num; j++) {
        if (num % j == 0) {
          flag = false;
        }
      }
      return flag;
    }

    var num = parseInt(prompt("请输入一个偶数"));
    var flag = isgdbh(num);
    if (flag) {
      alert(num + "满足哥德巴赫猜想");
    } else {
      alert(num + "不满足哥德巴赫猜想");
    }

  </script>
</body>

</html>